package com.service.impl;

import com.dao.StudentsDao;
import com.entity.Students;
import com.service.StudentsService;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

import javax.annotation.Resource;
import java.util.List;

@Service
public class StudentsServiceImpl implements StudentsService {
    @Resource
    private StudentsDao studentsDaoImpl;

    @Transactional(rollbackFor = Exception.class)
    @Override
    public void add(Students s) throws Exception {
        studentsDaoImpl.add(s);
    }

    @Override
    public void query(String identify) {
        studentsDaoImpl.query(identify);
    }

    @Transactional(rollbackFor = Exception.class)
    @Override
    public void delete(String identify) throws Exception {
        studentsDaoImpl.delete(identify);
    }

    @Transactional(rollbackFor = Exception.class)
    @Override
    public void update(Students s) throws Exception {
        studentsDaoImpl.update(s);
    }

    @Override
    public List<Students> queryAll() {
        return studentsDaoImpl.queryAll();
    }

    @Transactional(rollbackFor = Exception.class)
    @Override
    public void addBatch(List<Students> stus) throws Exception {

        studentsDaoImpl.addBatch(stus);

    }
}
